function fn1() {
  // 输入一个年份判断润年
  let y = prompt('输入年份:')
  y = parseInt(y)
  if (isNaN(y)) {
    return
  }
  let rt = (y % 4 == 0 && y % 100 !== 0) || y % 400 === 0
  if (rt) {
    console.log(`${y}年是闰年`)
  } else {
    console.log(`${y}年不是闰年`)
  }
}

// 输入数字判断是周几
function fn2() {
  // 输入数字判断是周几
  let day = prompt('输入1-7的整数:')
  day = parseInt(day)
  if (isNaN(day)) {
    return
  }
  let box = document.getElementsByClassName('box')[0]
  switch (day) {
    case 1: {
      box.innerHTML = '周一'
      break
    }
    case 2: {
      box.innerHTML = '周二'
      break
    }
    case 3: {
      box.innerHTML = '周三'
      break
    }
    case 4: {
      box.innerHTML = '周四'
      break
    }
    case 5: {
      box.innerHTML = '周五'
      break
    }
    case 6: {
      box.innerHTML = '周六'
      break
    }
    case 7: {
      box.innerHTML = '周日'
      break
    }
    default: {
      alert('非法的日期')
      break
    }
  }
}

fn2()
